<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Index modules | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'index-modules.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/index-modules.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/index-modules.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/index-modules.html" rel="nofollow" target="_blank">../en/index-modules.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-node">Index modules</span>
</div>
<div class="navheader">
<span class="prev">
<a href="analysis-normalizers.html">« Normalizers</a>
</span>
<span class="next">
<a href="index-modules-analysis.html">Analysis »</a>
</span>
</div>
<div class="part">
<div class="titlepage"><div><div>
<h1 class="title">
<a id="index-modules"></a>Index modules<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules.asciidoc">edit</a>
</h1>
</div></div></div>
<div class="openblock partintro">
<div class="content">
<p>Index Modules are modules created per index and control all aspects related to
an index.</p>
<h2>
<a id="index-modules-settings"></a>Index Settings<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules.asciidoc">edit</a>
</h2>
<p>Index level settings can be set per-index.  Settings may be:</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<em>static</em>
</span>
</dt>
<dd>
They can only be set at index creation time or on a
<a class="xref" href="indices-open-close.html" title="Open index API">closed index</a>.
</dd>
<dt>
<span class="term">
<em>dynamic</em>
</span>
</dt>
<dd>
They can be changed on a live index using the
<a class="xref" href="indices-update-settings.html" title="Update index settings API">update-index-settings</a> API.
</dd>
</dl>
</div>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Changing static or dynamic index settings on a closed index could
result in incorrect settings that are impossible to rectify without deleting
and recreating the index.</p>
</div>
</div>
<h3>
<a id="_static_index_settings"></a>Static index settings<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules.asciidoc">edit</a>
</h3>
<p>Below is a list of all <em>static</em> index settings that are not associated with any
specific index module:</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.number_of_shards</code>
</span>
</dt>
<dd>
The number of primary shards that an index should have.  Defaults to 1.
This setting can only be set at index creation time.  It cannot be
changed on a closed index. Note: the number of shards are limited to <code class="literal">1024</code> per
index. This limitation is a safety limit to prevent accidental creation of indices
that can destabilize a cluster due to resource allocation. The limit can be modified
by specifying <code class="literal">export ES_JAVA_OPTS="-Des.index.max_number_of_shards=128"</code> system property on every node that is
part of the cluster.
</dd>
<dt>
<span class="term">
<code class="literal">index.shard.check_on_startup</code>
</span>
</dt>
<dd>
<p>
Whether or not shards should be checked for corruption before opening. When
corruption is detected, it will prevent the shard from being opened.
Accepts:
</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">false</code>
</span>
</dt>
<dd>
(default) Don’t check for corruption when opening a shard.
</dd>
<dt>
<span class="term">
<code class="literal">checksum</code>
</span>
</dt>
<dd>
Check for physical corruption.
</dd>
<dt>
<span class="term">
<code class="literal">true</code>
</span>
</dt>
<dd>
<p>
Check for both physical and logical corruption. This is much more
expensive in terms of CPU and memory usage.
</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Expert only. Checking shards may take a lot of time on large
indices.</p>
</div>
</div>
</dd>
</dl>
</div>
</dd>
<dt>
<span class="term">
<a id="index-codec"></a> <code class="literal">index.codec</code>
</span>
</dt>
<dd>
The <code class="literal">default</code> value compresses stored data with LZ4
compression, but this can be set to <code class="literal">best_compression</code>
which uses <a href="https://en.wikipedia.org/wiki/DEFLATE" class="ulink" target="_top">DEFLATE</a> for a higher
compression ratio, at the expense of slower stored fields performance.
If you are updating the compression type, the new one will be applied
after segments are merged. Segment merging can be forced using
<a class="xref" href="indices-forcemerge.html" title="Force merge API">force merge</a>.
</dd>
<dt>
<span class="term">
<a id="routing-partition-size"></a> <code class="literal">index.routing_partition_size</code>
</span>
</dt>
<dd>
The number of shards a custom <a class="xref" href="mapping-routing-field.html" title="_routing field">routing</a> value can go to.
Defaults to 1 and can only be set at index creation time. This value must be less
than the <code class="literal">index.number_of_shards</code> unless the <code class="literal">index.number_of_shards</code> value is also 1.
See <a class="xref" href="mapping-routing-field.html#routing-index-partition" title="Routing to an index partition">Routing to an index partition</a> for more details about how this setting is used.
</dd>
<dt>
<span class="term">
<a id="load-fixed-bitset-filters-eagerly"></a> <code class="literal">index.load_fixed_bitset_filters_eagerly</code>
</span>
</dt>
<dd>
Indicates whether <a class="xref" href="query-filter-context.html" title="Query and filter context">cached filters</a> are pre-loaded for
nested queries. Possible values are <code class="literal">true</code> (default) and <code class="literal">false</code>.
</dd>
<dt>
<span class="term">
<a id="index-hidden"></a> <code class="literal">index.hidden</code>
</span>
</dt>
<dd>
Indicates whether the index should be hidden by default. Hidden indices are not
returned by default when using a wildcard expression. This behavior is controlled
per request through the use of the <code class="literal">expand_wildcards</code> parameter. Possible values are
<code class="literal">true</code> and <code class="literal">false</code> (default).
</dd>
</dl>
</div>
<h3>
<a id="dynamic-index-settings"></a>Dynamic index settings<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules.asciidoc">edit</a>
</h3>
<p>Below is a list of all <em>dynamic</em> index settings that are not associated with any
specific index module:</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.number_of_replicas</code>
</span>
</dt>
<dd>
The number of replicas each primary shard has.  Defaults to 1.
</dd>
<dt>
<span class="term">
<code class="literal">index.auto_expand_replicas</code>
</span>
</dt>
<dd>
Auto-expand the number of replicas based on the number of data nodes in the cluster.
Set to a dash delimited lower and upper bound (e.g. <code class="literal">0-5</code>) or use <code class="literal">all</code>
for the upper bound (e.g. <code class="literal">0-all</code>). Defaults to <code class="literal">false</code> (i.e. disabled).
Note that the auto-expanded number of replicas only takes
<a class="xref" href="shard-allocation-filtering.html" title="Index-level shard allocation filtering">allocation filtering</a> rules into account, but ignores
any other allocation rules such as <a class="xref" href="modules-cluster.html#shard-allocation-awareness" title="Shard allocation awareness">shard allocation awareness</a>
and <a class="xref" href="allocation-total-shards.html" title="Total shards per node">total shards per node</a>, and this can lead to the
cluster health becoming <code class="literal">YELLOW</code> if the applicable rules prevent all the replicas
from being allocated.
</dd>
<dt>
<span class="term">
<code class="literal">index.search.idle.after</code>
</span>
</dt>
<dd>
How long a shard can not receive a search or get request until it’s considered
search idle. (default is <code class="literal">30s</code>)
</dd>
</dl>
</div>
<div class="variablelist">
<a id="index-refresh-interval-setting"></a>
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.refresh_interval</code>
</span>
</dt>
<dd>
How often to perform a refresh operation, which makes recent changes to the
index visible to search. Defaults to <code class="literal">1s</code>.  Can be set to <code class="literal">-1</code> to disable
refresh. If this setting is not explicitly set, shards that haven’t seen
search traffic for at least <code class="literal">index.search.idle.after</code> seconds will not receive
background refreshes until they receive a search request. Searches that hit an
idle shard where a refresh is pending will wait for the next background
refresh (within <code class="literal">1s</code>). This behavior aims to automatically optimize bulk
indexing in the default case when no searches are performed. In order to opt
out of this behavior an explicit value of <code class="literal">1s</code> should set as the refresh
interval.
</dd>
</dl>
</div>
<div class="variablelist">
<a id="index-max-result-window"></a>
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.max_result_window</code>
</span>
</dt>
<dd>
The maximum value of <code class="literal">from + size</code> for searches to this index. Defaults to
<code class="literal">10000</code>. Search requests take heap memory and time proportional to
<code class="literal">from + size</code> and this limits that memory. See
<a class="xref" href="search-request-body.html#request-body-search-scroll" title="Scroll">Scroll</a> or <a class="xref" href="search-request-body.html#request-body-search-search-after" title="Search After">Search After</a> for a more efficient alternative
to raising this.
</dd>
<dt>
<span class="term">
<code class="literal">index.max_inner_result_window</code>
</span>
</dt>
<dd>
The maximum value of <code class="literal">from + size</code> for inner hits definition and top hits aggregations to this index. Defaults to
<code class="literal">100</code>. Inner hits and top hits aggregation take heap memory and time proportional to <code class="literal">from + size</code> and this limits that memory.
</dd>
<dt>
<span class="term">
<code class="literal">index.max_rescore_window</code>
</span>
</dt>
<dd>
The maximum value of <code class="literal">window_size</code> for <code class="literal">rescore</code> requests in searches of this index.
Defaults to <code class="literal">index.max_result_window</code> which defaults to <code class="literal">10000</code>. Search
requests take heap memory and time proportional to
<code class="literal">max(window_size, from + size)</code> and this limits that memory.
</dd>
<dt>
<span class="term">
<code class="literal">index.max_docvalue_fields_search</code>
</span>
</dt>
<dd>
The maximum number of <code class="literal">docvalue_fields</code> that are allowed in a query.
Defaults to <code class="literal">100</code>. Doc-value fields are costly since they might incur
a per-field per-document seek.
</dd>
<dt>
<span class="term">
<code class="literal">index.max_script_fields</code>
</span>
</dt>
<dd>
The maximum number of <code class="literal">script_fields</code> that are allowed in a query.
Defaults to <code class="literal">32</code>.
</dd>
</dl>
</div>
<div class="variablelist">
<a id="index-max-ngram-diff"></a>
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.max_ngram_diff</code>
</span>
</dt>
<dd>
The maximum allowed difference between min_gram and max_gram for NGramTokenizer and NGramTokenFilter.
Defaults to <code class="literal">1</code>.
</dd>
</dl>
</div>
<div class="variablelist">
<a id="index-max-shingle-diff"></a>
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.max_shingle_diff</code>
</span>
</dt>
<dd>
The maximum allowed difference between max_shingle_size and min_shingle_size
for the <a class="xref" href="analysis-shingle-tokenfilter.html" title="Shingle token filter"><code class="literal">shingle</code> token filter</a>. Defaults to
<code class="literal">3</code>.
</dd>
<dt>
<span class="term">
<code class="literal">index.blocks.read_only</code>
</span>
</dt>
<dd>
Set to <code class="literal">true</code> to make the index and index metadata read only, <code class="literal">false</code> to
allow writes and metadata changes.
</dd>
<dt>
<span class="term">
<code class="literal">index.blocks.read_only_allow_delete</code>
</span>
</dt>
<dd>
Similar to <code class="literal">index.blocks.read_only</code>, but also allows deleting the index to
make more resources available. The <a class="xref" href="modules-cluster.html#shard-allocation-awareness" title="Shard allocation awareness">disk-based shard
allocator</a> may add and remove this block automatically.
</dd>
</dl>
</div>
<p>Deleting documents from an index to release resources - rather than deleting the index itself - can increase the index size over time. When <code class="literal">index.blocks.read_only_allow_delete</code> is set to <code class="literal">true</code>, deleting documents is not permitted. However, deleting the index itself releases the read-only index block and makes resources available almost immediately.</p>
<div class="important admon">
<div class="icon"></div>
<div class="admon_content">
<p>Elasticsearch adds and removes the read-only index block automatically when the disk utilization falls below the high watermark, controlled by <a class="xref" href="modules-cluster.html#cluster-routing-flood_stage">cluster.routing.allocation.disk.watermark.flood_stage</a>.</p>
</div>
</div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.blocks.read</code>
</span>
</dt>
<dd>
Set to <code class="literal">true</code> to disable read operations against the index.
</dd>
<dt>
<span class="term">
<code class="literal">index.blocks.write</code>
</span>
</dt>
<dd>
Set to <code class="literal">true</code> to disable data write operations against the index. Unlike <code class="literal">read_only</code>,
this setting does not affect metadata. For instance, you can close an index with a <code class="literal">write</code>
block, but not an index with a <code class="literal">read_only</code> block.
</dd>
<dt>
<span class="term">
<code class="literal">index.blocks.metadata</code>
</span>
</dt>
<dd>
Set to <code class="literal">true</code> to disable index metadata reads and writes.
</dd>
<dt>
<span class="term">
<code class="literal">index.max_refresh_listeners</code>
</span>
</dt>
<dd>
Maximum number of refresh listeners available on each shard of the index.
These listeners are used to implement <a class="xref" href="docs-refresh.html" title="?refresh"><code class="literal">refresh=wait_for</code></a>.
</dd>
<dt>
<span class="term">
<code class="literal">index.analyze.max_token_count</code>
</span>
</dt>
<dd>
The maximum number of tokens that can be produced using _analyze API.
Defaults to <code class="literal">10000</code>.
</dd>
<dt>
<span class="term">
<code class="literal">index.highlight.max_analyzed_offset</code>
</span>
</dt>
<dd>
The maximum number of characters that will be analyzed for a highlight request.
This setting is only applicable when highlighting is requested on a text that was indexed without offsets or term vectors.
Defaults to <code class="literal">1000000</code>.
</dd>
</dl>
</div>
<div class="variablelist">
<a id="index-max-terms-count"></a>
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.max_terms_count</code>
</span>
</dt>
<dd>
The maximum number of terms that can be used in Terms Query.
Defaults to <code class="literal">65536</code>.
</dd>
</dl>
</div>
<div class="variablelist">
<a id="index-max-regex-length"></a>
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index.max_regex_length</code>
</span>
</dt>
<dd>
The maximum length of regex that can be used in Regexp Query.
Defaults to <code class="literal">1000</code>.
</dd>
<dt>
<span class="term">
<code class="literal">index.routing.allocation.enable</code>
</span>
</dt>
<dd>
<p>
Controls shard allocation for this index. It can be set to:
</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<code class="literal">all</code> (default) - Allows shard allocation for all shards.
</li>
<li class="listitem">
<code class="literal">primaries</code> - Allows shard allocation only for primary shards.
</li>
<li class="listitem">
<code class="literal">new_primaries</code> - Allows shard allocation only for newly-created primary shards.
</li>
<li class="listitem">
<code class="literal">none</code> - No shard allocation is allowed.
</li>
</ul>
</div>
</dd>
<dt>
<span class="term">
<code class="literal">index.routing.rebalance.enable</code>
</span>
</dt>
<dd>
<p>
Enables shard rebalancing for this index. It can be set to:
</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<code class="literal">all</code> (default) - Allows shard rebalancing for all shards.
</li>
<li class="listitem">
<code class="literal">primaries</code> - Allows shard rebalancing only for primary shards.
</li>
<li class="listitem">
<code class="literal">replicas</code> - Allows shard rebalancing only for replica shards.
</li>
<li class="listitem">
<code class="literal">none</code> - No shard rebalancing is allowed.
</li>
</ul>
</div>
</dd>
<dt>
<span class="term">
<code class="literal">index.gc_deletes</code>
</span>
</dt>
<dd>
The length of time that a <a class="xref" href="docs-delete.html#delete-versioning" title="Versioning">deleted document’s version number</a> remains available for <a class="xref" href="docs-index_.html#index-versioning" title="Versioning">further versioned operations</a>.
Defaults to <code class="literal">60s</code>.
</dd>
<dt>
<span class="term">
<code class="literal">index.default_pipeline</code>
</span>
</dt>
<dd>
The default <a class="xref" href="ingest.html" title="Ingest node">ingest node</a> pipeline for this index. Index requests will fail
if the default pipeline is set and the pipeline does not exist. The default may be
overridden using the <code class="literal">pipeline</code> parameter. The special pipeline name <code class="literal">_none</code> indicates
no ingest pipeline should be run.
</dd>
<dt>
<span class="term">
<code class="literal">index.final_pipeline</code>
</span>
</dt>
<dd>
The final <a class="xref" href="ingest.html" title="Ingest node">ingest node</a> pipeline for this index. Index requests
will fail if the final pipeline is set and the pipeline does not exist.
The final pipeline always runs after the request pipeline (if specified) and
the default pipeline (if it exists). The special pipeline name <code class="literal">_none</code>
indicates no ingest pipeline will run.
</dd>
</dl>
</div>
<h3>
<a id="_settings_in_other_index_modules"></a>Settings in other index modules<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules.asciidoc">edit</a>
</h3>
<p>Other index settings are available in index modules:</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<a class="xref" href="analysis.html" title="Text analysis">Analysis</a>
</span>
</dt>
<dd>
Settings to define analyzers, tokenizers, token filters and character
filters.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-allocation.html" title="Index Shard Allocation">Index shard allocation</a>
</span>
</dt>
<dd>
Control over where, when, and how shards are allocated to nodes.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-mapper.html" title="Mapper">Mapping</a>
</span>
</dt>
<dd>
Enable or disable dynamic mapping for an index.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-merge.html" title="Merge">Merging</a>
</span>
</dt>
<dd>
Control over how shards are merged by the background merge process.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-similarity.html" title="Similarity module">Similarities</a>
</span>
</dt>
<dd>
Configure custom similarity settings to customize how search results are
scored.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-slowlog.html" title="Slow Log">Slowlog</a>
</span>
</dt>
<dd>
Control over how slow queries and fetch requests are logged.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-store.html" title="Store">Store</a>
</span>
</dt>
<dd>
Configure the type of filesystem used to access shard data.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-translog.html" title="Translog">Translog</a>
</span>
</dt>
<dd>
Control over the transaction log and background flush operations.
</dd>
<dt>
<span class="term">
<a class="xref" href="index-modules-history-retention.html" title="History retention">History retention</a>
</span>
</dt>
<dd>
Control over the retention of a history of operations in the index.
</dd>
</dl>
</div>
<h3>
<a id="x-pack-index-settings"></a><span class="xpack">X-Pack index settings</span><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a><a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/index-modules.asciidoc">edit</a>
</h3>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<a class="xref" href="ilm-settings.html" title="Index lifecycle management settings in Elasticsearch">Index lifecycle management</a>
</span>
</dt>
<dd>
Specify the lifecycle policy and rollover alias for an index.
</dd>
</dl>
</div>
</div>
</div>










</div>
<div class="navfooter">
<span class="prev">
<a href="analysis-normalizers.html">« Normalizers</a>
</span>
<span class="next">
<a href="index-modules-analysis.html">Analysis »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>